Enter the password ? permission denied
This is because the string variable WORD$
in the INPUT statement
will have no characters input into it.
A string with no characters in it is not equal to SECRET.
Just as with numerical variables, there is a not equal relational symbol:
oneString <> anotherString
A relational expression with <> is true when the two strings are different.
| "Secret" <> "Secret" | false | |
| "Secret" <> "secret" | true | |
| "secret" <> "secret" | false | |
| "flute" <> "tuba" | true | |
| "red shift" <> "red shift" | false | |
| "red shift" <> "redshift" | true |
Say that an art museum charges admission on every day except Thursday. Here is a program that checks if admission will be charged.
' Admission Checker ' PRINT "What day is it" INPUT DAY$ IF DAY$ <> "Thursday" THEN PRINT "Charge Admission" ELSE PRINT "Free Day" END IF ' END
What does the program do if the user enters "Monday" ?